package com.gdones.bootserver.core.config;

import com.anji.captcha.service.CaptchaCacheService;
import com.gdones.bootserver.core.util.MyRedisUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 模块名称：AJCapcha缓存配置实现类
 * 模块类型：
 * 编码人：高靖博
 * 创建时间：2023/3/20
 * 联系电话：18587388612
 */
@Service
@RequiredArgsConstructor
public class CaptchaCacheServiceRedisImpl implements CaptchaCacheService {

    @Autowired
    private MyRedisUtil redisUtil;

    @Override
    public void set(String s, String s1, long l) {
        redisUtil.set(s,s1,l);
    }

    @Override
    public boolean exists(String s) {
        return redisUtil.hasKey(s);
    }

    @Override
    public void delete(String s) {
        redisUtil.del(s);
    }

    @Override
    public String get(String s) {
        return (String)redisUtil.get(s);
    }

    @Override
    public String type() {
        return "redis";
    }
}
